/*
 * LutEditor.cpp
 *
 *  Created on: 1 sep 2011
 *      Author: nicolas
 */


#include "LutEditor.h"

#include <wx/menu.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include "liblut/gui/wx/LutWxPanelView.h"

IMPLEMENT_APP(LutEditor)

bool
LutEditor::OnInit()
{
    m_ptrFrame=new LutEditorMainFrame(wxT("IGN/MATIS LUT Editor "),
                                      wxDefaultPosition,
                                      wxSize(300,350));
    m_ptrFrame->Show(true);
    m_ptrFrame->OnInit();
    return true;
}

BEGIN_EVENT_TABLE(LutEditorMainFrame, wxFrame)
    EVT_MENU(ID_Quit, LutEditorMainFrame::OnQuit)
    EVT_MENU(ID_About, LutEditorMainFrame::OnAbout)
END_EVENT_TABLE()


LutEditorMainFrame::LutEditorMainFrame(const wxString& title,
                               const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size, wxDEFAULT_FRAME_STYLE)
{
    SetMinSize(wxSize(300,350));
    SetMaxSize(wxSize(400,600));
    //********** Panel - GUI design
    // aui manager
    m_mgr.SetManagedWindow(this);
    Show(true);
    //lutWxPanel
    LutWxPanelView* lut_panel=new LutWxPanelView(this);
    m_mgr.AddPane(lut_panel, wxCENTER, wxT("LUT"));
    m_mgr.GetPane(lut_panel).MinSize(lut_panel->GetMinSize());
    //wxBoxSizer *globalsizer = new wxBoxSizer(wxHORIZONTAL);
    //globalsizer->Add(lut_panel,1,wxEXPAND|wxALIGN_TOP,4);
    //SetSizer(globalsizer);
    CreateMenu();
    CreateStatusBar(3);
    SetStatusText( _T("Matis - IGN"),0);
    m_mgr.Update();
}

void
LutEditorMainFrame::CreateMenu()
{
    m_menuBar = new wxMenuBar;
    wxMenu *menuFile = new wxMenu;
    menuFile->Append( ID_About, _T("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _T("&Exit") );
    wxMenu *menuLut = new wxMenu;
    SetMenuBar( m_menuBar );
}

LutEditorMainFrame::~LutEditorMainFrame()
{
  m_mgr.UnInit();
}

void
LutEditorMainFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox(_T("This is a wxWidgets Hello world sample"),
            _T("About"), wxOK | wxICON_INFORMATION, this);
}

void
LutEditorMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(TRUE);
}

void
LutEditorMainFrame::OnInit()
{
}

